"""
@Project:efficient
@File:serializer.py
@Author:韩晓雷
@Date:16:45
"""
import re
from rest_framework import serializers
from user.models import *
from rest_framework.validators import ValidationError


# 工资条
class SalarySer(serializers.ModelSerializer):
    user = serializers.PrimaryKeyRelatedField(queryset=UserModel.objects.all())
    user_name = serializers.SerializerMethodField(read_only=True)

    def get_user_name(self, obj):
        return obj.user.name

    class Meta:
        model = Salary
        fields = "__all__"




